<template>
  <div>
    社保
    <hr />
    <UploadExcel :before-upload="beforeUpload" :on-success="onSuccess" />
  </div>
</template>

<script>
export default {
  //  注册事件
  methods: {
    beforeUpload (file) {
      console.log(file)
      const limitSize = file.size / 1024 < 100
      if (!limitSize) {
        this.$message.error('请上传小于100k的文件')
      }
      const limitType = /\.(xlsx|xls|csv)$/.test(file.name)
      if (!limitType) {
        this.$message.error('请上传小于1k的(xlsx|xls|csv)文件')
      }
      return limitSize && limitType
    },
    onSuccess (obj) {
      console.log(obj)
    }
  }
}
</script>

<style></style>
